// pages/edu/exam/exam_result/index.js
import{ExamJobs} from '../../model/exam_jobs'
const ExamJobsModel=new ExamJobs()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    id:0,
    info:{}
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if(options.id){
      this.data.id=options.id
      this._getExamResultUser()
    }
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },

  //-------------------------------

  /**
   * 获取用户的考试结果
   */
  _getExamResultUser(){
    let id=this.data.id
    ExamJobsModel.getExamResultUser(id,(res)=>{
      this.setData({
        info:res
      })
    })
  },
  onHome(){
    wx.navigateTo({
      url: '../index/index',
    });
  },
  onBack(){
    wx.navigateBack({
      delta: 1, // 回退前 delta(默认为1) 页面
    })
  }
})